const getFileIcon = (type) => {
    switch (type) {
        case "ppt":
            return "ppt-"
            break;

        case "":
            return "pdf-"
            break;

        case "doc":
            return "word-"
            break;

        case "docx":
            return "word-"
            break;

        case "xls":
            return "excel-"
            break;

        case "xlsx":
            return "excel-"
            break;

        case "zip":
            return "yasuobao-"
            break;

        case "txt":
            return "txt-"
            break;
    
        default:
            return "txt-"
            break;
    }
}

const getFileType = (filePath) => {
    var startIndex = filePath.lastIndexOf(".");
    if (startIndex != -1)
        return filePath.substring(startIndex + 1, filePath.length).toLowerCase();
    else return "";
}

const getFileFullName = (filePath) => {
    return filePath.split('/')[filePath.split('/').length - 1]
}

const getFileName = (filePath) => {
    let fileFullName = getFileFullName(filePath)
    return fileFullName.substring(0, fileFullName.lastIndexOf('.'))
}

export {
    getFileIcon,
    getFileType,
    getFileFullName,
    getFileName
}